<template>
<h2>充值</h2>
<table class="table table-bordered">
    <tr>
        <td>充值金额</td>
        <td>
            <input type="text" v-model="jine"/><span>每充值1元获得一点积分</span>
        </td>
    </tr>
    <tr>
        <td>充值方式</td>
        <td>
            <input type="radio" :value="0" v-model="ztype"/>现金
            <input type="radio" :value="1" v-model="ztype"/>微信
            <input type="radio" :value="2" v-model="ztype"/>支付宝
        </td>
    </tr>
    <tr>
        <td colspan="2">
            <input type="button" class="btn btn-info" @click="chonghzi" value="充值"/>
        </td>
    </tr>
</table>
</template>
<script setup lang="ts">
import {ref,onMounted} from 'vue'
import axios from 'axios'
import { useRouter,useRoute } from 'vue-router';
const router=useRouter()
const route=useRoute()

const ztype=ref(0)

const jine=ref('')

const chonghzi=()=>{
    axios.get('https://localhost:7279/api/Meber/Chongzhi',{
        params:{
            id:route.params.id,
            jine:jine.value
        }
    })
    .then(res=>{
        if(res.data>0){
            alert('充值成功')
            router.push('/MeberShow')
        }
        else{
            alert('充值成功')
        }
    })
}



</script>